-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring (opt-in) IMC async handler #8311
Allow configuring (opt-in) IMC async handler #8311
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8311 +/- ##
==========================================
+ Coverage 64.58% 64.62% +0.03%
==========================================
Files 373 373
Lines 22619 22649 +30
==========================================
+ Hits 14609 14636 +27
- Misses 7244 7246 +2
- Partials 766 767 +1 ☔ View full report in Codecov by Sentry. |
83f210b
to
055fae7
Compare
@@ -60,8 +60,11 @@ type Subscription struct { | |||
// Config for a fanout.EventHandler. | |||
type Config struct { | |||
Subscriptions []Subscription `json:"subscriptions"` | |||
// Deprecated: AsyncHandler controls whether the Subscriptions are called synchronous or asynchronously. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we release note that this is not deprecated
anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only at the code level / library and we usually don't release note it since pretty much all users don't care
return &multichannelfanout.ChannelConfig{ | ||
Namespace: imc.Namespace, | ||
Name: imc.Name, | ||
HostName: imc.Status.Address.URL.Host, | ||
Path: fmt.Sprintf("%s/%s", imc.Namespace, imc.Name), | ||
FanoutConfig: fanout.Config{ | ||
AsyncHandler: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a good idea to pass in the bool via configuration/annotation in case folks want to have it "async", and do not care about the impact.
Seems like a good idea to document this. for the next upstream release. /lgtm |
/test reconciler-tests |
1 similar comment
/test reconciler-tests |
|
@pierDipi looks like some unmarshal error for the boolean value |
} | ||
for k, v := range metadata.GetAnnotations() { | ||
if strings.HasPrefix(k, messagingv1.SchemeGroupVersion.Group) { | ||
channelAnnotations[k] = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this always a string?
@@ -24,7 +24,7 @@ metadata: | |||
{{ end }} | |||
{{ if .annotations }} | |||
{{ range $key, $value := .annotations }} | |||
{{ $key }}: {{ $value }} | |||
{{ $key }}: "{{ $value }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for strings, using explicit ""... made the TestBrokerPropagatesMetadata
work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(works on my machine 😅 kinda fix)
is because of this: https://github.com/knative/eventing/blob/main/pkg/apis/messaging/v1/in_memory_channel_validation.go#L92 |
/retest |
0feaf0b
to
1389906
Compare
@@ -17,6 +17,12 @@ kind: {{ .kind }} | |||
metadata: | |||
name: {{ .name }} | |||
namespace: {{ .namespace }} | |||
annotations: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when looking at the reconciler tests, I never saw the messaging.knative.dev/async-handler
annotation, hence adding this
@@ -191,12 +193,28 @@ func AsyncHandlerUpdate(createSubscriberFn func(ref *duckv1.KReference, uri stri | |||
f.Setup("channel is ready", channel_impl.IsReady(name)) | |||
f.Setup("subscription is ready", subscription.IsReady(sub)) | |||
|
|||
f.Requirement("update channel async handler", channel_impl.Install(name, channel_impl.WithAnnotations(map[string]interface{}{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking at the error again:
channel_impl.go:92: failed to update resource admission webhook "validation.inmemorychannel.eventing.knative.dev" denied the request: validation failed: Channel.Spec.Subscribers changed by user [email protected] which was not the system:serviceaccount:knative-eventing:eventing-controller service account: spec.subscribers
{[]v1.SubscriberSpec}:
-: "[{Name:0xc0009a5ea0 UID:828704ea-0f50-48ab-bcd7-9b9cacc19796 Generation:1 SubscriberURI:http://sink-dwarkbpn.test-wcdvjxod.svc.cluster.local/ SubscriberCACerts: SubscriberAudience: ReplyURI: ReplyCACerts: ReplyAudience: Delivery: Auth:}]"
+: "[]"
I saw that the subscribers are "replaced" w/ nothing (+:"[]"
), which lead me to the fact that we here just re-install the channel_impl, based from its manifest yaml
file, which lacks the actual subscribers
We switched to use the sync handler by default, however, it was reported that in some cases, this is not wanted as it slows down the source event senders since it needs to wait for all subscribers to receive events. While this is the best default behavior since reduces lost events in InMemoryChannel, we want to allow configuring this behavior, while documenting the downsides (follow up to docs repo) Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Pierangelo Di Pilato <[email protected]>
Signed-off-by: Matthias Wessendorf <[email protected]>
Signed-off-by: Matthias Wessendorf <[email protected]>
c180ebe
to
859dfff
Compare
@pierDipi I've update the PR, for the async-handler update. Mainly changing the test. See comments above |
/test unit-tests |
…s. Otherwise we loose the channel's Spec.Subscribers Signed-off-by: Matthias Wessendorf <[email protected]>
859dfff
to
b1e6f3d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @matzew !
LGTM (I can't LGTM my own PR but the new changes look good)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: matzew, pierDipi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest
Sent from Gmail Mobile
…On Mon 18. Nov 2024 at 11:13, knative-prow[bot] ***@***.***> wrote:
@pierDipi <https://github.com/pierDipi>: The following test *failed*, say
/retest to rerun all failed tests or /retest-required to rerun all
mandatory failed tests:
Test name Commit Details Required Rerun command
reconciler-tests_eventing_main b1e6f3d
<b1e6f3d>
link
<https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative_eventing/8311/reconciler-tests_eventing_main/1858441207496052736>
unknown /test reconciler-tests
Your PR dashboard <https://prow.knative.dev/pr>.
Instructions for interacting with me using PR comments are available here
<https://git.k8s.io/community/contributors/guide/pull-requests.md>. If
you have questions or suggestions related to my behavior, please file an
issue against the kubernetes-sigs/prow
<https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:>
repository. I understand the commands that are listed here
<https://go.k8s.io/bot-commands>.
—
Reply to this email directly, view it on GitHub
<#8311 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABGPTWCRN4Z6ZQ6NQROI332BG4RDAVCNFSM6AAAAABRKT5V6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBSGUZTEMBZHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
We switched to use the sync handler by default, however, it was
reported that in some cases, this is not wanted as it slows down
the source event senders since it needs to wait for all subscribers
to receive events.
While sync handler is the best default behavior since reduces lost events in
InMemoryChannel, we want to allow configuring this behavior, while
documenting the downsides (follow up to docs repo)
Proposed Changes
Pre-review Checklist
Release Note
Docs